<:!:/>

@file c.rules.html
@author Alejandro Dario Simi
@date $Date: 2013-06-22 17:58:11 +0000 (Sat, 22 Jun 2013) $

$Id: c.rules.html 83 2013-06-22 17:58:11Z daemonraco@gmail.com $
$URL: http://wcomix.googlecode.com/svn/tags/wcomix-1.0.0.1/themes/default/templates/contents/c.rules.html $

<::/><script type="text/javascript">
	function CreateRule() {
		var	name = $("#NewRuleName").val().trim();
		if(name.length > 0) {
			jQuery.post('service.php?action=<:VAR:/>WC_SERVICE_RULES<::/>&group=<:VAR:/>GROUP-ID<::/>&create', {
						'NAME':	$("#NewRuleName").val().trim()
					}, function(data){
				var	xml = $($.parseXML(data));
				if(xml.find("wc-success").length) {
					window.location.href = "?action=<:VAR:/>WC_ACTION_RULE_SHOW<::/>&group=<:VAR:/>GROUP-ID<::/>&rule=" + xml.find("wc-result>rule>id").text();
				} else if(xml.find("wc-failed").length) {
					var	error = "";
					if(xml.find("wc-error>wc-code").length) {
						error = "[" + xml.find("wc-error>wc-code").text() + "] ";
					}
					error = error + xml.find("wc-error>wc-message").text();

					alert("Failed: " + error);
				}
			});
		} else {
			$("#NewRuleName").focus();
			alert("You must enter a rule name");
		}

		return false;
	}
</script>

<:ISSET:var=RULES-CREATE:/><form id="RulesForm" class="Formulary" action="#" onsubmit="CreateRule(); return false" method="get">
	<table><tr>
		<td class="Title" colspan="2"><span class="Title">Create a new rule</span></td>
	</tr><tr>
		<td class="Label">Name</td><td class="Value">
			<input class="Full" type="text" id="NewRuleName" value=""/>
		</td>
	</tr><tr>
		<td colspan="2" class="Buttons">
			<input type="submit" value="Create Rule"/>
		</td>
	</tr></table>
</form><::/>

<table class="GeneralView"><:OVER:list=RULES-LISTS:/><tr>
	<td class="Title">
		<hr/>
		<span class="Prefix"><:VAR:/>prefix<::/></span>
	</td>
</tr><tr>
	<td class="SmallItemsPool">
		<:OVER:list=list:/>
<:INCLUDE:padding=3:/>/generics/bundlepreview.html<::/>
		<::/>
	</td>
</tr><::/></table>

<:INCLUDE:padding=0:/>/generics/pager.html<::/>
